/* Copyright (c) 2004-2024 Peigen.info. All rights reserved. */

package info.peigen.hotpot.component.gateway.dianlan.protocol.passive;

import info.peigen.hotpot.component.gateway.dianlan.annotations.DianlanProtocol;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import lombok.experimental.FieldDefaults;
import lombok.experimental.SuperBuilder;

import static info.peigen.hotpot.component.gateway.dianlan.annotations.DianlanProtocol.DianlanProtocolDataType.BCD;
import static info.peigen.hotpot.component.gateway.dianlan.annotations.DianlanProtocol.DianlanProtocolDataType.BIN;

/**
 * <b>(DianlanBmsAndChargeMachineOutput)</b>
 * <p>
 * GBT-27930 充电桩与 BMS 充电过程 BMS 需求、充电机输出
 * 帧类型码 0x23(35)
 * 序列号域 0019
 * 数据长度 30(48)
 * 帧校验域 1D57
 *
 * @author Peigen
 * @version 1.0.0
 * @since 2022/8/19
 */
@SuperBuilder
@Data
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults(level = AccessLevel.PRIVATE)
@Accessors(chain = true)
public class DianlanBmsAndChargeMachineOutput {
    /** 交易流水号 */
    @DianlanProtocol(length = 16, start = 0, end = 16, dataType = BCD)
    String transNo;
    /** 桩编码 */
    @DianlanProtocol(length = 7, start = 16, end = 23, dataType = BCD)
    String stubNo;
    /** 充电枪号 */
    @DianlanProtocol(length = 1, start = 23, end = 24, dataType = BCD)
    String chargingPortNo;
    /** BMS 电压需求接收 0.1 V/位，0 V 偏移量 */
    @DianlanProtocol(length = 2, start = 24, end = 26, dataType = BIN)
    String bmsVoltageRequest;
    /** BMS 电流需求接收 0.1 A/位，-400 A 偏移量 */
    @DianlanProtocol(length = 2, start = 26, end = 28, dataType = BIN)
    String bmsCurrentRequest;
    /** BMS 充电模式 0x01：恒压充电；0x02：恒流充电 */
    @DianlanProtocol(length = 1, start = 28, end = 30, dataType = BIN)
    String bmsChargeType;
    /** BMS 充电电压测量值 0.1 V/位，0 V 偏移量 */
    @DianlanProtocol(length = 2, start = 30, end = 32, dataType = BIN)
    String bmsVoltageMeasureValue;
    /** BMS 充电电流测量值 0.1 A/位，-400 A 偏移量 */
    @DianlanProtocol(length = 2, start = 32, end = 34, dataType = BIN)
    String bmsCurrentMeasureValue;
    /**
     * BMS  最高单体动力蓄电池电压及组号
     * 1-12 位：最高单体动力蓄电池电压，数据分辨率：0.01 V/位，0 V 偏移量；数据范围：0~24 V；
     * 13-16 位：最高单体动力蓄电池电压所在组号，数据分辨率：1/位. 0偏移量；数据范围：0~15
     */
    @DianlanProtocol(length = 2, start = 34, end = 36, dataType = BIN)
    String maxSingleBatteryVoltageAndGroupNo;
    /** BMS 当前荷电状态 SOC（ %） 1%/位，0%偏移量；数据范围：0~100% */
    @DianlanProtocol(length = 1, start = 36, end = 37, dataType = BIN)
    String bmsCurrentSoc;
    /** BMS 估算剩余充电时间 1 min/位，0 min 偏移量；数据范围：0~600 min */
    @DianlanProtocol(length = 2, start = 37, end = 39, dataType = BIN)
    String bmsRemainChargeTime;
    /** 电桩电压输出值 */
    @DianlanProtocol(length = 2, start = 39, end = 41, dataType = BIN)
    String stubVoltageOutput;
    /** 电桩电流输出值 */
    @DianlanProtocol(length = 2, start = 41, end = 43, dataType = BIN)
    String stubCurrentOutput;
    /** 累计充电时间 */
    @DianlanProtocol(length = 2, start = 43, end = 45, dataType = BIN)
    String chargeDuration;
}